﻿Public Class CTipoValorValmer

' En esta clase se propone un adaptador al tipo de Emisora, con la finalidad de solventar la carencia de un catálogo de tipo de 
' Emisoras en la Base de datos (POSIBLE OPTIMIZACIÓN, beneficio: versatilidad dinámica)


Private _idEmisora   As TipoEmisora  
Private _descEmisora As String 
Private _tipoValor   As String 
Private _esEditableNuevo As Boolean 



Public  Property EsEditableNuevo() As Boolean 
    Get
        Return _esEditableNuevo
    End Get    
    Set(ByVal value As Boolean )
            _esEditableNuevo = value
    End Set
End Property





Public Enum TipoEmisora 
   ninguno = 0
   Gubernamental = 1 
   Banca_Corporativo = 2
End Enum


Public Sub new()

   Me.IdEmisora =  TipoEmisora.ninguno 
   Me.TipoValor =  ""
   Me.EsEditableNuevo = False 
End Sub


Public Sub new(ByVal emisora As TipoEmisora, ByVal nombreValor As String)

   Me.IdEmisora = emisora 
   Me.TipoValor = nombreValor 
   Me.EsEditableNuevo = False 
End Sub


Public Sub new(ByVal emisora As TipoEmisora, ByVal nombreValor As String, ByVal esEditable As Boolean )

   Me.IdEmisora = emisora 
   Me.TipoValor = nombreValor 
   Me.EsEditableNuevo = esEditable 
End Sub





Public Property IdEmisora() As TipoEmisora 
    Get
        Return _idEmisora
    End Get
    Set(ByVal value As TipoEmisora )
        _idEmisora = value
        Select Case value 
           Case TipoEmisora.Gubernamental  
                _descEmisora = "Gubernamental"
           Case TipoEmisora.Banca_Corporativo
                _descEmisora = "Bancario/Corporativo"          
        End Select
    End Set
End Property



Public Property DescEmisora() As String
    Get
        Return _descEmisora 
    End Get
    Set(ByVal value As String)
        _descEmisora = value
    End Set
End Property



Public Property TipoValor() As String
    Get
        Return _tipoValor
    End Get
    Set(ByVal value As String)
        _tipoValor = value
    End Set
End Property


    Public Overrides Function ToString() As String
        Return _descEmisora
    End Function


End Class
